arr = [1, 2, 3, 4]
s = set()

def dfs(temp, start, end):
    if start == end:
        s.add(str(temp))
    else:
        for i in range(start, end + 1):
            temp[start], temp[i] = temp[i], temp[start]
            dfs(temp, start + 1, end)
            temp[start], temp[i] = temp[i], temp[start]


for i in range(0, len(arr)):
    temp = arr.copy()
    del temp[i]
    dfs(temp, 0, len(temp) - 1)

print("一共", len(s), "种")
for i in s:
    print(i)
